#include <bits/stdc++.h>
using namespace std;
using uint=unsigned int;
using ll=long long;
using ull=unsigned long long;
using i128=__int128;
const int N=1e6+5;

void solve(){
    int a,b;
    cin>>a>>b;
    if(a==b){
        cout << 0 << endl;
        return;
    }
    int tgt=a^b;
    int mask=1<<(31-__builtin_clz(tgt));
    if(a>tgt){
        cout<<1<<endl;
        cout<<tgt<<endl;
    }
    else if(b<mask){
        int x1=tgt^mask;
        int x2=mask;
        cout<<2<<endl;
        cout<<x1<<" "<<x2<<endl;
    }
    else cout<<-1<<endl;
    return;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t;
    cin>>t;
    while(t--)solve();

    return 0;
}